package com.ku.kill.error;

/**
 * @program: kill2
 * @description: 通用错误信息
 * @author: JokerKu
 * @create: 2020-04-02 16:12
 **/
public enum EmBusinessError implements CommonError{
    //通用错误类型10000
    PARMATER_VALIDATION_ERROR(10001,"参数不合法"),
    UNKONMW_ERROR(10002,"未知错误"),
    VERIFY_CODE_ERROR(10003,"验证码错误"),

    //2000开头的错误码为用户信息相关错误的定义
    USER_NOT_EXIT(20001,"用户不存在"),
    USER_LOGIN_FAIL(20002,"用户手机号或密码错误"),
    USER_NOT_LOGIN(20003,"用户未登录"),
    OTP_COUNT_FULL(20003,"该手机号当日发送验证码达到上限，请明日再试"),
    //3000开头的错误码为商品信息相关错误的定义
    ITEM_NOT_EXIT(30001,"商品不存在"),
    RATE_LIMITE(30002,"活动太火爆，请稍后再试"),

    //4000开头的错误码为订单信息相关错误的定义
   STOCK_NOT_ENOUGH(40001,"商品库存数量不足"),
   MQ_SEND_FAIL(40002,"更新数据库库存消息发送失败"),
   KILL_TOKEN_NOT_EXIT(40003,"秒杀令牌不存在"),
    ;



    EmBusinessError(int errorCode, String errorMsg) {
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }
    private int errorCode;
    private String errorMsg;

    @Override
    public int getCode() {
        return this.errorCode;
    }

    @Override
    public String getErrorMsg() {
        return this.errorMsg;
    }


    public void setErrorCode(int errorCode) {
        this.errorCode = errorCode;
    }

    @Override
    public CommonError setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
        return this;
    }
}
